<%--
  document: sale.jsp
  
  description:
    Products for resale.
 --%>

<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>

<%-- Importations --%>
<%@page import="javax.el.*" %>
<%@page import="javax.naming.*" %>
<%@page import="javax.transaction.*" %>
<%@page import="javax.faces.context.*" %>
<%@page import="com.reimscopie.*" %>
<%@page import="com.reimscopie.controlers.*" %>
<%@page import="com.reimscopie.beans.interfaces.* "%>

<%-- Tag libs --%>
<%@taglib uri="http://java.sun.com/jsf/core" prefix="core"%> 
<%@taglib uri="http://java.sun.com/jsf/html" prefix="html"%> 

<%-- Controlers --%>
<%@ include file="jspf/controlers.jspf" %>

<%-- i18n --%>
<%@include file="jspf/i18n/i18n.jspf" %>

<%
    Context context = new InitialContext() ;
    String name ="com.reimscopie.beans.session.ReimsCopieUserBean_" +
    ReimsCopieUserLocal.class.getName()+"@Local" ;    
    ReimsCopieUserLocal bean = (ReimsCopieUserLocal)context.lookup(name) ;   
    
    String transactionName = "javax.transaction.UserTransaction" ;
    UserTransaction transaction =
            (UserTransaction)context.lookup(transactionName);
    transaction.begin() ;
    
    String variableget="-1" ;
    
    if ((variableget = request.getParameter("navigation")) == null)
      variableget = "-1" ;
    
    int productId = Integer.parseInt(variableget) ;
%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
          "http://www.w3.org/TR/html4/loose.dtd">

<html>
	<head>
    <%@ include file = "jspf/header.jspf" %>
	</head>
  
  <body>
    
<core:view>
  
  <div id="page">
  
    <%@include file = "jspf/top.jspf" %>
    
    <div id="middle">
      <div id="menu">
        <div id="search">
          <%@ include file = "jspf/search.jspf" %>
        </div>
        <div id="menu_task">
          <%@ include file = "jspf/sale/menu.jspf" %>
        </div>
      </div>
      
      <div id="contents">
         <div id="onglet">
           <%! String activeTab = "sale"; %>
           <%@ include file = "jspf/onglet.jspf" %>
         </div>

         <div id="tree">
           <%@ include file = "jspf/sale/tree.jspf" %>
         </div>
         
         <div id="in">
<%
     try {
       if (productId != -1) {%>
          <%@ include file = "jspf/sale/product.jspf" %>
<%     }
       else {%>
       <div class="center-left">
         <%@include file = "jspf/sale/contents.jspf" %>
       </div>
<% }
        }
        catch (Exception e) {
          e.printStackTrace() ;
          transaction.rollback() ;
        }
%>

       <div class="center-end">
       </div>
                   
     </div>
      
   </div>
 </div>
  
 <div id="page_end">
   <%@ include file = "jspf/page-end.jspf" %>
 </div>
  
 </core:view>
 
<%@ include file = "jspf/footer.jspf" %>

<%
    transaction.commit();    
%>
